prepare-root: Fix ostree= kernel argument at end
authorColin Walters <walters@verbum.org>
Sun, 1 Sep 2013 08:16:52 +0000 (04:16 -0400)
committerColin Walters <walters@verbum.org>
Mon, 2 Sep 2013 17:27:41 +0000 (13:27 -0400)
commit9e497a4ce7cfde5db9605353590c1fe037f969ac
tree81d8d3c2c30a49af4e7e37371f66e478863eeea9
parent52dd6b0b749cdcea2f9d14557aac83086c083a05
prepare-root: Fix ostree= kernel argument at end

Extracting the code for parse_ostree_cmdline() and running it on some
test input (on RHEL6.4 glibc), I can reproduce the odd behavior from
getline() where it apparently returns the size of the default malloc
buffer in the size output, and some non-zero value.

This behavior would be OK except that it breaks the logic for
stripping off the trailing newline, which in turn breaks booting
because we return "ostree=foo\n".

This has worked so far in gnome-ostree because syslinux apparently
injects initrd=/path/to/initrd as a final kernel argment.

Anyways, we don't handle NUL characters here in /proc/cmdline, so
let's just call strlen () to be safe.

https://bugzilla.gnome.org/show_bug.cgi?id=707192
src/switchroot/ostree-prepare-root.c